تمرین برنامه نویسی؛ با کدبزن!

منبع جامع سوالات و تمرینات برنامه نویسی

محاسبه تخفیف

Hossein آسان 114/ دانلود 2371 بازدید

لیستی از اجناس مختلف به همراه درصد تخفیف آنها داریم و میخواهیم بدانیم قیمت نهایی هر محصول بعد از لحاظ کردن تخفیف چقدر میشود.

برنامه ای بنویسید که همانند زیر قیمت محصول و درصد تخفیف آن را دریافت کند و قیمت نهایی و مقدار تخفیف را در خروجی چاپ کند.

تا وقتی کاربر عدد 0 وارد نکرده است برنامه باید ادامه یابد


gheymat mahsool: 10000000
darsad takhfif: 20

gheymat nahaei = 8000000
takhfif = 2000000

30 جواب

نمیتونم این تمرین رو حل کنم!
gheymat = int ( input ( "First Gheymat : "))
Takhfif = int ( input ( "Takhfif : " ) )

print ( "You paid {} and don't pay {}" . format ( gheymat - (gheymat * ( Takhfif / 100 ) ) , gheymat * ( Takhfif / 100 ) ) )
Kian1390 دانلود Python
num = int(input('num: '))
ta = int(input())
print(num-(num * ta / 100))
print(num * ta / 100)
Amirhosein دانلود Python
while True:
    product_price = float(input("Enter price of the product(to exit print(0) ) : "))
    if product_price == 0:
        break
    
    product_discount = float(input("Enter discount of product : "))
     
    discount_amont = product_price * product_discount/100
    final_price = product_price-discount_amont
    print (".............................................")
    print ("product_price :" , product_price)
    print ("product_discount :" , product_discount)
    print (".............................................")
    print ("discount_amont :" , discount_amont )
    print ("final_price : " , final_price)
    print ("...............................................")
Tadashi دانلود Python
a=float(input("gheymat:"))
b=float(input("darsad takhfif:"))
print("gheymat nahaii=" , a-(a*(b/100)))
print("takhfif=" , a*(b/100))
Mm000 دانلود Python
while True:
    a=int(input("gheimate kala...>"))
    b=float(input("darsade takhfif...>"))
    c=a*b
    d=a-c
    print(d)
    if a==0:
        break
Mary12 دانلود Python
while True:
    mahsol = input('1.poshak :  ')
    if mahsol == '1':
        price =int (input("price : "))
        off =int (input("off : "))
        print(price * off / 100)


    if mahsol=='0':
        break
print (mahsol)        
Farshad10 دانلود Python
while True:
    
    a=float(input("ghimat mahsool:"))
    if a==0:
        break
    b=float(input("drsad takhfif:"))
    c=a*b/100
    d=a-c
    print("ghimat nahai mahssol:",int(d))
    print("takhfif:",int(c))
کاربر 1991 دانلود Python
while True :
    price=float(input('price : '))
    if price==0:
        break
    disc= float(input('discount : '))
    
    print('price with discount : {}'.format(price*(1-(disc/100))))
Soheyl دانلود Python
while True:
  ghei=int(input('gheimat:'))
  if ghei==0 :break
  takhfif=int(input("takhfif:"))
  if takhfif==0 :break
  d=int(takhfif*ghei/100)
  o=ghei-d
  print(o)   
Amirrafei76 دانلود Python
def f():
    while True:
        try:
            a=int(input('enter the price:'))
            if a==0:
                break
            b=int(input('enter takhfif:'))
            if b==100:
                print('price=0')
                print('takhfif=%s'%(a))
            if b>100 or b<0:
                print(jhjh)
            w=(b/100)*a
            a=a-((b/100)*a)
            print('price=%s'%(int(a)))
            print('takhfif=%s'%(int(w)))
        except:
            print('takhfif must be between 0 and 100')
print(f())
کاربر 2595 دانلود Python
<< صفحه قبل 1 2 3 صفحه بعد >>

ارسال جواب

# کداتو توی این بخش بنویس
# فرقی نمیکنه چه زبان برنامه نویسی باشه، همرو پشتیبانی میکنیم :)
# البته قبلش این سه خط رو پاک کن
                    
  • لطفا جواب های تکراری ارسال نکن
  • قبل از ارسال، جوابت رو داخل یک کد ادیتور مثل vscode بنویس و بعد اینجا Paste کن
  • جواب های ارسالی، پس از بررسی کوتاهی، ویرایش میشن و در سایت نمایش داده میشن
  • ارسال جواب حق مادی یا معنوی برای ارسال کننده ایجاد نمیکند و تمام حقوق برای سایت کدبزن محفوظ است

تمرینات مرتبط

تشخیص با استفاده از هوش مصنوعی
×
×
بستن